home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Franz PD / Franz PD Disk #111 (1991-01)(Amiga User Group Deutschland e.V.).zip / Franz PD Disk #111 (1991-01)(Amiga User Group Deutschland e.V.).adf / IntroMaker_V1.2 / Utilities / ConvertST.asm < prev    next >
Assembly Source File  |  1989-07-03  |  4KB  |  214 lines

  1. * Convert SoundTracker by E.Hambuch
  2. * konvertiert SoundTrackerfiles in ladbares Format
  3. * für IntroMaker  Version 1.1
  4. * für A68k-Assembler
  5. CALLEXEC: macro
  6.   move.l 4,a6
  7.   jsr _LVO\1(a6)
  8.   endm
  9. CALLDOS: macro
  10.   move.l _DOSBase,a6
  11.   jsr _LVO\1(a6)
  12.   endm
  13. _LVOOldOpenLibrary: equ -408
  14. _LVOCloseLibrary:   equ -414
  15. MODE_OLDFILE: equ 1005
  16. MODE_NEWFILE: equ 1006
  17. _LVOOpen:  equ -30
  18. _LVOClose:  equ -36
  19. _LVORead:  equ -42
  20. _LVOWrite: equ -48
  21. _LVOInput: equ -54
  22. _LVOOutput: equ -60
  23. _LVOLock: equ -84
  24. _LVOUnLock: equ -90
  25. _LVOExamine: equ -102
  26. pr_CLI     equ $ac
  27. pr_MsgPort equ $5c
  28.   movem.l d0/a0,-(sp)
  29.   clr.l _WBenchMsg
  30.   sub.l a1,a1
  31.   move.l 4,a6   ; ExecBase
  32.   jsr -294(a6)  ; FindTask
  33.   move.l d0,a4
  34.   tst.l pr_CLI(a4)
  35.   beq.s fromWorkbench
  36.   movem.l (sp)+,d0/a0
  37.   bra run
  38. fromWorkbench
  39.   lea pr_MsgPort(a4),a0
  40.   jsr -384(a6)  ; WaitPort
  41.   lea pr_MsgPort(a4),a0
  42.   jsr -372(a6)  ; GetMsg
  43.   move.l d0,_WBenchMsg
  44.   movem.l (sp)+,d0/a0
  45. run
  46.   bsr.s _main
  47.   move.l d0,-(sp)
  48.   tst.l _WBenchMsg
  49.   beq.s _exit
  50.   move.l 4,a6   ; ExecBase
  51.   jsr -132(a6)  ; Forbid
  52.   move.l _WBenchMsg(pc),a1
  53.   jsr -378(a6)  ; ReplyMsg
  54. _exit
  55.   move.l (sp)+,d0
  56.   rts
  57. _WBenchMsg
  58.   ds.l 1
  59.   even
  60. _main:
  61.   lea dosname,a1
  62.   CALLEXEC OldOpenLibrary
  63.   move.l d0,_DOSBase
  64.   beq ende
  65.   tst.l _WBenchMsg
  66.   beq clistart
  67.   move.l #fenster,d1
  68.   move.l #MODE_NEWFILE,d2
  69.   CALLDOS Open
  70.   move.l d0,Out
  71.   move.l d0,Inp
  72.   beq closedos
  73.   bra start
  74. clistart:
  75.   CALLDOS Output
  76.   move.l d0,Out
  77.   beq closedos
  78.   jsr _LVOInput(a6)
  79.   move.l d0,Inp
  80.   beq closedos
  81. start:
  82.   lea text1,a0
  83.   bsr print
  84. forever:
  85.   lea text2,a0
  86.   bsr print
  87.   move.l Inp,d1
  88.   move.l #Buffer1,d2
  89.   moveq #79,d3
  90.   jsr _LVORead(a6)
  91.   cmp.b #1,d0
  92.   ble closedos
  93.   lea Buffer1,a0
  94.   clr.b -1(a0,d0.w)
  95.   lea text3,a0
  96.   bsr print
  97.   move.l Inp,d1
  98.   move.l #Buffer2,d2
  99.   moveq #79,d3
  100.   jsr _LVORead(a6)
  101.   lea Buffer2,a0
  102.   clr.b -1(a0,d0.w)
  103.   move.l #Buffer1,d1
  104.   bsr filelen
  105.   move.l d0,Len
  106.   bne.s w0
  107.   lea text4,a0
  108.   bsr print
  109.   bra forever
  110. w0:
  111.   move.l #Buffer1,d1
  112.   move.l #MODE_OLDFILE,d2
  113.   jsr _LVOOpen(a6)
  114.   move.l d0,File1
  115.   bne.s w1
  116.   lea text4,a0
  117.   bsr print
  118.   bra forever
  119. w1:
  120.   move.l #Buffer2,d1
  121.   move.l #MODE_NEWFILE,d2
  122.   jsr _LVOOpen(a6)
  123.   move.l d0,File2
  124.   bne.s w2
  125.   move.l File1,d1
  126.   jsr _LVOClose(a6)
  127.   lea text5,a0
  128.   bsr print
  129.   bra forever
  130. w2:
  131.   move.l File2,d1
  132.   move.l #Len,d2
  133.   moveq #4,d3
  134.   jsr _LVOWrite(a6)
  135.   move.l File2,d1
  136.   move.l #Period,d2
  137.   moveq #2,d3
  138.   jsr _LVOWrite(a6)
  139. writesamp:
  140.   move.l File1,d1
  141.   move.l #FIBlock,d2
  142.   move.l #260,d3
  143.   jsr _LVORead(a6)
  144.   move.l d0,d3
  145.   ble closefiles
  146.   move.l File2,d1
  147.   move.l #FIBlock,d2
  148.   jsr _LVOWrite(a6)
  149.   tst.l d0
  150.   bpl writesamp
  151. closefiles:
  152.   move.l File1,d1
  153.   jsr _LVOClose(a6)
  154.   move.l File2,d1
  155.   jsr _LVOClose(a6)
  156.   bra forever
  157. closeall:
  158.   tst.l _WBenchMsg
  159.   beq.s closedos
  160.   move.l Out,d1
  161.   CALLDOS Close
  162. closedos:
  163.   move.l _DOSBase,a1
  164.   CALLEXEC CloseLibrary
  165. ende: rts
  166. print:
  167.   move.l a0,a1
  168. s00: tst.b (a1)+
  169.   bne.s s00
  170.   suba.l a0,a1
  171.   move.l Out,d1
  172.   move.l a0,d2
  173.   move.l a1,d3
  174.   subq.l #1,d3
  175.   jmp _LVOWrite(A6)  
  176. filelen:
  177.   moveq #-2,d2
  178.   CALLDOS Lock
  179.   move.l d0,d7
  180.   beq endfilelen
  181.   move.l d0,d1
  182.   move.l #FIBlock,d2
  183.   jsr _LVOExamine(a6)
  184.   move.l d0,-(sp)
  185.   move.l d7,d1
  186.   jsr _LVOUnLock(a6)
  187.   move.l (sp)+,d0
  188.   beq.s endfilelen
  189.   move.l FIBlock+124,d0
  190. endfilelen: rts
  191.   DATA
  192. dosname: dc.b 'dos.library',0
  193. text1: dc.b 'ConvertSoundTracker 1.1 by E.Hambuch',10
  194.        dc.b '------------------------------------',10,10,0
  195. text2: dc.b 'In>',0
  196. text3: dc.b 'Out>',0
  197. text4: dc.b 'Cant open input file !',10,7,0
  198. text5: dc.b 'Cant open output file !',10,7,0
  199. fenster: dc.b 'CON:0/0/640/200/ConvertST V1.1',0
  200.   even
  201. Period: dc.w 15625  ;Frequenz in Herz
  202.   BSS
  203. _DOSBase:   ds.l 1
  204. Out:        ds.l 1
  205. Inp:        ds.l 1
  206. Len:        ds.l 1
  207. File1:       ds.l 1
  208. File2:       ds.l 1
  209.  cnop 0,4 ;muß auf Langwort liegen
  210. FIBlock:    ds.b 264
  211. Buffer1:    ds.b 80
  212. Buffer2:    ds.b 80
  213.   END
  214.